﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace aier.dataaccess.model
{
    [global::System.AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
    public class XrmReferenceTypeAttribute : Attribute
    {
        readonly string entityName;
        readonly string referenceNameField;
        readonly bool allowEmpty;

        public XrmReferenceTypeAttribute(string entityName,string referenceValueField,bool allowEmpty)
        {
            this.entityName = entityName;
            this.referenceNameField = referenceValueField;
            this.allowEmpty = allowEmpty;
        }

        public XrmReferenceTypeAttribute(string entityName, string referenceValueField)
            : this(entityName, referenceValueField, false)
        {

        }

        public string EntityName
        {
            get { return entityName; }
        }

        public string ReferenceValueField
        {
            get { return referenceNameField; }
        }

        public bool AllowEmpty
        {
            get { return allowEmpty; }
        }
    }
}
